#!/usr/local/bin/python
# -*- coding: utf-8 -*-


# 创建session
import initLogger
import os
#import pysqlcipher3

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

import internal


TEST_MODE="test_environment"
PRODUCTION_MODE="production_environment"
RUNNING_MODE="test_environment"
#RUNNING_MODE="production_environment"


#################################################################
# 公共配置
#################################################################


#数据库配置
appPath = os.getcwd()
initLogger.logger.debug("appPath:%s"%(appPath))



if appPath.find("AccountBoy\\dist")>0:
    #在打包目录运行exe文件
    #sqlPath = 'sqlite:///database//data14.db'

    sqlPath = internal.sqlPath1

elif appPath.find("AccountBoy\\")>0:
    #数据库文件目录运行测试
    #sqlPath = 'sqlite:///../database//data14.db'
    sqlPath = internal.sqlPath2


else:
    #其他情况
    #sqlPath = 'sqlite:///database//data14.db'
    sqlPath = internal.sqlPath3



initLogger.logger.debug("sqlPath:%s"%(sqlPath))

'''

 
# SQLITE_URL = 'sqlite:///D:/dd/aippw.db3'  #sqlite连接地址
# SQLITE_URL = 'sqlite+pysqlcipher://:123123@/D:/dd/mydb.db3'  #sqlite连接地址，文件生成在d:\dd\目录
SQLITE_URL = 'sqlite+pysqlcipher://:123123@/mydb.db3'  #sqlite连接地址，文件生成在当前目录
 
 

'''
#engine = create_engine(sqlPath)
#DbSession = sessionmaker(bind=engine)
#session = DbSession()

engine = create_engine(sqlPath, echo=True)
DbSession = sessionmaker(bind=engine)
session = DbSession()
#Base = declarative_base()


FIRST_YEAR = 2020
YEAR_NAME_LIST = ["2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027"]
YEAR_VALUE_LIST = [2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027]

MONTH_NAME_LIST = ["1", "2", "3", "4",
                   "5", "6", "7", "8",
                   "9", "10", "11", "12"]
MONTH_VALUE_LIST = [1, 2, 3, 4,
                    5, 6, 7, 8,
                    9, 10, 11, 12]


#确实时候还需要？？？？？？？？？？？？？？？？？？？？？？
# 页面页面配置信息
ACCOUNT_VOUCHER_PAGE = 0            #记账凭证页面
ACCOUNT_BOOK_PAGE = 1               #账簿页面
BALANCE_SHEET_PAGE = 2              #资产负债表页面
INCOME_STATEMENT_PAGE = 3           #收支表页面
CASH_FLOW_STATEMENT_PAGE = 4        #现金流表页面  【未实现】
ALIPAY_BILL_PAGE = 5                #支付宝账单页面
STATISTICAL_CHART_PAGE = 6          #统计图表页面
XIRR_WORK_PAGE = 7                  #收益率展示页面


# 菜单项
MENU_ACCOUNT_VOUCHER = "记账凭证"
MENU_ACCOUNT_BOOK = "账簿"

# 资产科目长度
PROPERTY_LEN = 5
OWNERSHIP_LEN = 6


# 记账数据类型
TYPE_PROPERTY = "property"
TYPE_OWNERSHIP = "ownership"

# 设置向前追溯天数，
GO_DAYS = 27




PROPERTY_NAME_JSON_OLD = '''
{"资产":
    {
	"自有":
        {
		"货币":
			{
			"现金":"",
			"银行存款":
				{
					"工行":"",
					"招行":"",
					"交通银行":"",
					"网商银行":"",
					"招行定期":""
				},
			"电子货币":
				{	
					"支付宝":"",
					"微信":""				
				},
			"兑换外汇":""			
			},
		"应收款":"",
		"预付款":"",
		"固定资产":
			{
				"房屋":"",
				"汽车":""			
			}
        },


    "投资":
		{
			"理财":
				{
					"招行货币基金":"",
					"沪深300指数基金":"",
					"中证500指数增强基金":"",
					"鹏华丰禄债券基金":"",
					"招商产业债券A基金":"",
					"支付宝基金":"",
					"增额终身寿":"",
					"分红型保险":"",
					"万能保险":""

				},
			"股票":
				{
					"招商证券":"",
					"平安证券":""
					
				},
			"房产":""
		
		}

	}
}
'''



OWNERSHIP_NAME_JSON_OLD = '''
{"权属":
	{
    "自有":
		{

			"本年结余":
				{
					"日常":
						{
							"收入":
								{
									"工资":"",
									"公积金":"",
									"补贴":""

								},							
							"支出":
								{

									"家庭日常":"",
									"上缴领导":"",
									"刷卡消费":"",
									"花呗消费":"",
									"建行房贷":"",
									"招行房贷":"",
									"购买保险":"",
									"金融手续费":"",
									"爱车养车":"",
									"餐饮美食":"",
									"充值缴费":"",
									"服饰装扮":"",
									"家居家装":"",
									"交通出行":"",
									"母婴亲子":"",
									"日用百货":"",
									"数码电器":"",
									"文化休闲":"",
									"医疗健康":"",
									"转账红包":"",
									"生活服务":"",
									"运动户外":"",
									"教育培训":"",
									"酒店旅游":"",
									"衣":"",
									"食":"",
									"住":"",
									"行":"",
									"话":"",
									"学":"",
									"娱乐":"",
									"其他":""
								}
						},

					"投资":
						{
							"理财":"",
							"股票":"",
							"出租":"",
							"余额宝投资":""
						},
					"例外":""
				},
			"初始资金":"",
			"追加资金":"",
			"历年积累":""
		},

		"负债":
			{
			"信用卡":"",			
			"应收款":"",
			"预付款":"",
			"蚂蚁花呗":""			
			}
		}	
}

'''

#									"商业服务":"",




















